Skip to content

fix DASH VOD and Live manifest and segment pacing#21

Open
gmarzot wants to merge 4 commits intoBlazemeter:masterfrom
gmarzot:master
Open

fix DASH VOD and Live manifest and segment pacing#21
gmarzot wants to merge 4 commits intoBlazemeter:masterfrom
gmarzot:master

Conversation

@gmarzot
Copy link
Copy Markdown

@gmarzot gmarzot commented Jan 30, 2021

This works for DASH Live and VOD. Manifest GET rate for Live will not exceed media segment duration. For DASH VOD segment GET rate is determined by segment duration.

I have not looked at HLS yet.

@gmarzot
Copy link
Copy Markdown
Author

gmarzot commented Feb 18, 2021

any interest?

@sebastianlorenzo88
Copy link
Copy Markdown

Hello, thanks for your contribution, we are going to review and test the PR as soon as possible.

Regards.

Copy link
Copy Markdown

@sebastianlorenzo88 sebastianlorenzo88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,

I left you some comments, mostly regarding code style to follow the conventions of the project.

Thanks for your contribution.
Regards

while (!mediaPlayback.hasEnded()) {
if (mediaPlayback.needsManifestUpdate() && !initialLoop) {
long awaitMillis = manifest.getReloadTimeMillis(timeMachine.now());
long segmentDurationMillis = (long) mediaPlayback.getLastSegment().getDurationSeconds() * 1000;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is too long, does not fit with code style

Suggested change
long segmentDurationMillis = (long) mediaPlayback.getLastSegment().getDurationSeconds() * 1000;
long segmentDurationMillis =
(long) mediaPlayback.getLastSegment().getDurationSeconds() * 1000;

return segmentBuilder != null;
}

// dynamic manifests (live) or empty segment list require manifest get (timing determined elsewhere)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again this line is too long

Suggested change
// dynamic manifests (live) or empty segment list require manifest get (timing determined elsewhere)
// dynamic manifests (live) or empty segment list require manifest get (timing determined
// elsewhere)

import io.lindstrom.mpd.data.Period;
import io.lindstrom.mpd.data.PresentationType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the project code style, the imports should be in alphabetical order

private final Instant lastDownLoadTime;
private final List<MediaPeriod> periods;
private Instant playbackStartTime;
private static final Logger LOG = LoggerFactory.getLogger(Manifest.class);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static variables should be defined at the beginning of variables definition

public Instant getAvailabilityStartTime() {
OffsetDateTime time = mpd.getAvailabilityStartTime();
return time != null ? time.toInstant() : Instant.MIN;
// simulating availabilityStartTime for VOD enables pacing of segment GETs according to segment duration
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long

Suggested change
// simulating availabilityStartTime for VOD enables pacing of segment GETs according to segment duration
// simulating availabilityStartTime for VOD enables pacing of segment GETs according to
// segment duration

TimeMachine timeMachine, SampleResultProcessor sampleResultProcessor) {
//HLS Master Playlist must contain this .m3u8 extension in their URLs
if (url.contains(".m3u8")) {
if (url.contains(".m3u8")||url.contains("format=m3u8")) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space between OR

Suggested change
if (url.contains(".m3u8")||url.contains("format=m3u8")) {
if (url.contains(".m3u8") || url.contains("format=m3u8")) {

Comment on lines +89 to +95
public long getReloadTimeMillis(long segmentDurationMillis) {
Duration minUpdatePeriod = mpd.getMinimumUpdatePeriod();
// wait at least segment duration if minUpdatePeriod is 0 (or very small)
long maxIntervalTime = Math.max(minUpdatePeriod.toMillis(), segmentDurationMillis);
Instant now = Instant.now();

return Math.max(maxIntervalTime - Duration.between(lastDownLoadTime, now).toMillis(), 0);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both minUpdatePeriod & now could be inlined, due to them are only used once.

Suggested change
public long getReloadTimeMillis(long segmentDurationMillis) {
Duration minUpdatePeriod = mpd.getMinimumUpdatePeriod();
// wait at least segment duration if minUpdatePeriod is 0 (or very small)
long maxIntervalTime = Math.max(minUpdatePeriod.toMillis(), segmentDurationMillis);
Instant now = Instant.now();
return Math.max(maxIntervalTime - Duration.between(lastDownLoadTime, now).toMillis(), 0);
public long getReloadTimeMillis(long segmentDurationMillis) {
// wait at least segment duration if minUpdatePeriod is 0 (or very small)
long maxIntervalTime = Math.max(mpd.getMinimumUpdatePeriod().toMillis(), segmentDurationMillis);
return Math
.max(maxIntervalTime - Duration.between(lastDownLoadTime, Instant.now()).toMillis(), 0);
}

@RicardoPoleo
Copy link
Copy Markdown

Any updates on this PR? @gmarzot

@gmarzot
Copy link
Copy Markdown
Author

gmarzot commented Dec 6, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants